package com.example.aliyun.plus;
class MyThread extends Thread { // 继承Thread 类
    String title;
    public MyThread(String title) { // 构造函数
        this.title = title;
    }
    @Override
    public void run() { // 覆写run() 方法
        for (int i = 0; i < 10; i++) {
            System.out.println(this.title + " is Running"+ "------->" + i);
        }

    }
}

public class ThreadDemo {
    public static void main(String[] args) {
        new MyThread("demo-001").start(); // 同一个线程实例重复启动会报 IllegalThreadStateException
        new MyThread("demo-002").start();
        new MyThread("demo-003").start();
    }
}
